package com.cyl.XmlDemo.entity;

import java.util.Hashtable;
import java.util.Map;

/**
 * 现存房间列表
 * @author tyuio
 *
 */
public class RoomList {
	
	//RoomList对象
	private static RoomList instance = new RoomList();
	
	//房间列表
	private Map<String,RoomInfo> roomList = new Hashtable<String,RoomInfo>();
	
	private RoomList(){
	}
	
	
	public static RoomList getInstance(){
		return instance;
	}


	public RoomInfo getRoom(String roomName) {
		return roomList.get(roomName);
	}

	/**
	 * 向房间列表添加新的房间信息对象
	 * @param roomName 房间名称
	 * @param roomInfo 房间信息对象
	 */
	public void addRoom(String roomName,RoomInfo roomInfo) {
		roomList.put(roomName, roomInfo);
	}
	
	public boolean contain(String roomName){
		return roomList.containsKey(roomName);
	}

}
